package com.bju.mapper;

import com.bju.bean.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper {

    @Select("select * from user where username=#{username} and password =#{password}")
    User login(String username, String password);


    @Insert("insert into user values (default,#{username},#{password},#{telephone},#{email})")
    void register(User user);
    @Select("select * from user")
    List<User> queryUsers();

    @Update("update user set username = #{username}, password = #{password},telephone=#{telephone},email=#{email} WHERE id = #{id};")
    void updateUser(User user);
}
